package com.sugon.timer;

import java.util.Date;
import java.util.TimerTask;

/**
 * @desc:
 * @author: luoy
 * @date: 2021-12-02 16:00
 */
public class FooTimerTask extends TimerTask {
    private String name;

    public FooTimerTask(String name) {
        this.name = name;
    }

    public void run() {
        try {
            System.out.println("name="+name+",startTime="+new Date());
            Thread.sleep(3000);
            System.out.println("name="+name+",endTime="+new Date());

            //线程池执行
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
